﻿Imports ACompany.OrderProcessing.Model
Imports NUnit.Framework

<TestFixture()> _
Public Class OrderTests

    <Test()> _
    Public Sub An_Order_Cannot_Be_Processed_Unless_All_OF_The_Items_Are_In_Stock()

        Dim anOrder As New Order
        Dim aCustomer As New Customer
        Dim anAddress As New Address("Street", "City", "County", "PostCode")
        aCustomer.Address = anAddress
        Dim aProduct As New Product

        anOrder.Customer = aCustomer
        anOrder.DespatchAddress = anAddress

        aProduct.Name = "Hat"
        aProduct.Price = 78.99
        aProduct.Stock = 0

        anOrder.Add(aProduct)

        Assert.IsFalse(anOrder.CanProcess)

    End Sub

    <Test()> _
    Public Sub An_Order_Can_Be_Processed_If_All_Items_Are_In_Stock()

        Dim anOrder As New Order
        Dim aCustomer As New Customer
        Dim anAddress As New Address("Street", "City", "County", "PostCode")
        aCustomer.Address = anAddress
        Dim aProduct As New Product

        anOrder.Customer = aCustomer
        anOrder.DespatchAddress = anAddress

        aProduct.Name = "Hat"
        aProduct.Price = 78.99
        aProduct.Stock = 1

        anOrder.Add(aProduct)

        Assert.IsTrue(anOrder.CanProcess)

    End Sub

End Class